package com.example.blogsystem.dao;

import com.example.blogsystem.model.Userinfo;
import com.example.blogsystem.model.vo.UserinfoVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-09-03
 * Time: 23:18
 */

@Mapper
public interface UserMapper {

    @Insert("insert into userinfo(username,password) values (#{username},#{password})")
    int reg(Userinfo userinfo);

    @Select("select * from userinfo where username = #{username}")
    Userinfo getUserByName(@Param("username") String username);

    @Select("select * from userinfo where id = #{id}")
    UserinfoVO getUserById(@Param("id") int uid);
}
